import App from '../App.vue'

const home = r => require.ensure([], () => r(require('../page/home/home.vue')), 'home');
const category = r => require.ensure([], () => r(require('../page/category/category.vue')), 'category')
const productDetail = r => require.ensure([], () => r(require('../page/product/product.vue')), 'productDetail')
const cart = r => require.ensure([], () => r(require('../page/cart/cart.vue')), 'cart')
const login = r => require.ensure([], () => r(require('../page/login/login.vue')), 'login')
const profile = r => require.ensure([], () => r(require('../page/profile/profile.vue')), 'profile')
const payment = r => require.ensure([], () => r(require('../page/payment/payment.vue')), 'payment')
const address = r => require.ensure([], () => r(require('../page/address/address.vue')), 'address')
const order = r => require.ensure([], () => r(require('../page/order/order.vue')), 'order')
const orderList = r => require.ensure([], () => r(require('../page/order/children/list.vue')), 'orderList')

export default  [
  {
    path: '/',
    component: App,
    children: [
      {
        path: '',
        redirect: '/home'
      },
      {
        path: '/home',
        component: home,
      },
      {
        path: '/categories',
        component: category,
      },
      {
        path: '/detail',
        component: productDetail
      },
      {
        path: '/cart',
        component: cart
      },
      {
        path: '/login',
        component: login
      },
      {
        path: '/profile',
        component: profile
      },
      {
        path: '/payment',
        component: payment
      },
      {
        path: '/address',
        component: address
      },
      {
        path: '/order',
        component: order,
        children: [
          {
            path:'list',
            component: orderList
          }
        ]
      }
    ]
  }
]
